﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

namespace socialnexus
{
    public partial class ReadMessage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["socialnexusConnectionString"].ConnectionString);
            con.Open();
            string queryString = "select Top 1 VideoURL,messageID from Messages where FromUserId=1 and ToUserId=2";


            SqlCommand cmd = new SqlCommand(queryString, con);
            SqlDataReader reader = null;
            reader = cmd.ExecuteReader();
            string videoURL = reader["videoURL"].ToString();
            
            string messageID=reader["messageID"].ToString();
            string queryString1 = "update messages set isRead=True where messageID="+messageID;
            cmd = new SqlCommand(queryString1, con);
            reader = cmd.ExecuteReader();
    }
    }
}
